package zeus

import (
	"github.com/google/wire"
	"github.com/pkg/errors"
	"github.com/spf13/viper"
	"go.didapinche.com/goapi/uic_service_api"
	"go.didapinche.com/zeus-go/v2"
	"go.didapinche.com/zeus-go/v2/client"
)

// New is constructor of zclients
func New(v *viper.Viper) (*zeus.Zeus, error) {
	appName := v.GetString("app.id")
	z, err := zeus.New(appName)
	if err != nil {
		return nil, errors.Wrap(err, "create zclients error")
	}

	return z, nil
}

func NewUicService(z *zeus.Zeus) (uic_service_api.TChanUicService, error) {
	c, err := client.New(z, "UicService")
	if err != nil {
		return nil, errors.Wrap(err, "create zclients UicService error")
	}

	tc := uic_service_api.NewTChanUicServiceClient(c)

	return tc, nil

}

// ProviderSet is provider set for wire
var ProviderSet = wire.NewSet(New, NewUicService)
